﻿<ucd:HeaderedDialogWindow x:Class="ReflectionStudio.Components.Dialogs.Database.ProviderChoiceDialog"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:ucd="clr-namespace:ReflectionStudio.Controls;assembly=ReflectionStudio.Controls"
        xmlns:db="clr-namespace:ReflectionStudio.Core.Database;assembly=ReflectionStudio.Core"
        Title="Create a new data source"
        DialogDescription="Select a data provider from the list"
        DialogImage="/ReflectionStudio;component/Resources/Images/32x32/information.png"                          
        mc:Ignorable="d" 
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" Height="323" Width="384">
    <ucd:HeaderedDialogWindow.Resources>

        <DataTemplate x:Key="ProviderItemTemplate" DataType="{x:Type db:IDbSchemaProvider}">
            <Grid HorizontalAlignment="Stretch">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="35"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>
                <Image Source="/ReflectionStudio;component/Resources/Images/16x16/plugin.png" Margin="3" VerticalAlignment="Top"/>
                <StackPanel Grid.Column="1" Orientation="Vertical">
                    <TextBlock Text="{Binding Name}" FontWeight="Bold" Foreground="{DynamicResource NormalForegroundBrush}"/>
                    <TextBlock Text="{Binding Description}" Foreground="{DynamicResource NormalForegroundBrush}" ></TextBlock>
                </StackPanel>
            </Grid>
        </DataTemplate>

    </ucd:HeaderedDialogWindow.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="218*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <ListBox ItemsSource="{Binding Path=.}" Margin="5"
                        ItemTemplate="{StaticResource ProviderItemTemplate}"
                        IsSynchronizedWithCurrentItem="True" Name="ListBoxProviders"
                        HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
        </ListBox>
        <Button Content="Ok" Grid.Row="2" Height="23" HorizontalAlignment="Right" Margin="0,2,10,2" Name="btnOk" VerticalAlignment="Top" Width="75" Click="btnOk_Click" />
        <Button Content="Cancel" Grid.Row="2" Height="23" HorizontalAlignment="Right" Margin="0,2,100,2" Name="btnCancel" VerticalAlignment="Top" Width="75" Click="btnCancel_Click" />
    </Grid>
</ucd:HeaderedDialogWindow>
